Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for resource leaks on Shutdown() to help users #799

Merged
merged 10 commits into from
Aug 17, 2024

Conversation

RyanUnderhill
Copy link
Member

@RyanUnderhill RyanUnderhill commented Aug 15, 2024

Adds an instance count to the main types users allocate and destroy through our external API.

On calling Shutdown(), if any count is non zero it will say the count and type of what hasn't been cleaned up.
Will also say if Shutdown() hasn't been called.

Also adds a check on process exit that Shutdown() is called. If not, will give an error message and abort the process.

This should help users more easily write correct code. Trivial to extend to more types, just add to the type list and inherit from LeakChecked.

Example output:

[----------] Global test environment tear-down
[==========] 31 tests from 4 test suites ran. (45750 ms total)
[  PASSED  ] 31 tests.
Shutting down OnnxRuntime... done
OGA Error: 1 instances of struct Generators::Model were leaked.
    Please see the documentation for the API being used to ensure proper cleanup.

@RyanUnderhill RyanUnderhill changed the title [Ignore for now] Resource leak test Check for resource leaks on exit to help users Aug 16, 2024
@RyanUnderhill RyanUnderhill changed the title Check for resource leaks on exit to help users Check for resource leaks on process exit to help users Aug 16, 2024
@RyanUnderhill RyanUnderhill changed the title Check for resource leaks on process exit to help users Check for resource leaks on Shutdown() to help users Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants